var t = require("../../../@babel/runtime/helpers/defineProperty"), a = getApp();

Page({
    data: {
        list: [],
        page: 1,
        total_page: 1,
        stock_id: null,
        mobile: null,
        nums: null,
        show: !1,
        cate_name: ""
    },
    onLoad: function(t) {
        this.getData();
    },
    onReady: function() {},
    show_overlay: function(t) {
        this.setData({
            stock_id: t.currentTarget.dataset.id,
            show: !0
        });
    },
    onClickHide: function() {
        this.setData({
            show: !1
        });
    },
    onSearch: function(t) {
        this.setData({
            cate_name: t.detail
        }), this.getData({
            cate_name: t.detail,
            page: 1
        });
    },
    link: function(t) {
        var a = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageI/store_cloud_inventory/list/list?id=" + a
        });
    },
    InputHandle: function(a) {
        var e = a.currentTarget.dataset.type;
        this.setData(t({}, e, a.detail.value));
    },
    confirm: function() {
        var t = this, e = {
            stock_id: this.data.stock_id,
            mobile: this.data.mobile,
            nums: this.data.nums
        };
        a._postNetWork({
            url: a.getNetAddresss("plugin.store-cloud-stock.frontend.controllers.home.trans"),
            data: e,
            success: function(e) {
                var n = e.data, s = n.result, o = n.msg;
                if (0 == s) return a.tips(o);
                t.setData({
                    show: !1
                }), a.tips(o);
            }
        });
    },
    getMoreData: function() {
        if (!(this.data.page >= this.data.total_page)) {
            var t = {}, a = this.data.page + 1;
            t.page = a, this.data.cate_name && (t.cate_name = this.data.cate_name), this.getData(t);
        }
    },
    getData: function() {
        var t = this, e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
        a._getNetWork({
            url: a.getNetAddresss("plugin.store-cloud-stock.frontend.controllers.home.index"),
            data: e,
            success: function(e) {
                var n = e.data, s = n.result, o = n.msg, i = n.data, r = i.data, c = i.current_page, u = i.last_page;
                if (0 == s) return a.tips(o);
                t.setData({
                    page: c,
                    total_page: u
                }), 1 == c ? t.setData({
                    list: r || []
                }) : t.setData({
                    list: t.data.list.concat(r)
                });
            }
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.getMoreData();
    },
    onShareAppMessage: function() {}
});